﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Domain;

namespace Clannan.Models.JsonModel
{
    public class ReplyJsonModel
    {
        private int id;

        public int ID
        {
            get { return id; }
            set { id = value; }
        }

        private string content;

        public string Content
        {
            get { return content; }
            set { content = value; }
        }

        private DateTime time;

        public DateTime Time
        {
            get { return time; }
            set { time = value; }
        }

        private string username;

        public string Username
        {
            get { return username; }
            set { username = value; }
        }

        private string userImage;

        public string UserImage
        {
            get { return userImage; }
            set { userImage = value; }
        }

        private int pageID;

        public int PageID
        {
            get { return pageID; }
            set { pageID = value; }
        }

        /// <summary>
        /// 将对象复制给JsonModel类，防止序列化时会出现重复引用
        /// </summary>
        public ReplyJsonModel Copy(ReplyJsonModel replyJsonModel, Reply reply)
        {
            replyJsonModel.ID = reply.ID;
            replyJsonModel.Content = reply.Content;
            replyJsonModel.Time = reply.Time;
            replyJsonModel.Username = reply.UserInfo.Name;
            replyJsonModel.UserImage = reply.UserInfo.Image;
            replyJsonModel.PageID = reply.Page.ID;
            return replyJsonModel;
        }
    }
}